<template>
    <router-view />
</template>
<script>
export default {

    created () {
        if (sessionStorage.getItem('store')) {
            this.$store.replaceState(
                Object.assign({},
                    this.$store.state,
                    JSON.parse(sessionStorage.getItem('store'))
                )
            )
        }

        // 监听，在页面刷新时将vuex里的信息保存到sessionStorage里
        window.addEventListener('beforeunload', () => {
            sessionStorage.setItem('store', JSON.stringify(this.$store.state))
        })
    }
}
</script>
<style lang="stylus">
#app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    height: 100%;
}

.msgbox {
    width: 800px !important;
}
</style>
